<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="statics/css/car.css">
<link rel="stylesheet" type="text/css" href="statics/css/page.css">
<script type="text/javascript" src="statics/js/jquery-1.12.4.js"
	charset="UTF-8"></script>
<script type="text/javascript" src="statics/js/choose.js"
	charset="UTF-8"></script>
<script type="text/javascript" src="statics/js/usermanage.js"
	charset="UTF-8"></script>
<script type="text/javascript" src="statics/js/script/jquery.pagination.js" charset="UTF-8"></script>
<title>Insert title here</title>
<style type="text/css">
.tab1 {
	border-collapse: collapse;
	border: none;
	margin: 0 auto;
	font-size: 13px;
	clear: both;
}

button.btn {
	margin-left: 335px;
	margin-top: 15px;
}
.tab1 tr td input.check {
	border: none;
	/* background-color: blue; */
	width: 5%;
}

div h4 {
	font-weight: normal;
}

/* a.blueadd {
	color: white;
	background: #369CDA;
	line-height: 2em;
	padding: 0 16px;
	border-radius: 4px;
	margin-bottom: 3px;
	float: left;
    margin-top: 4px;
    margin-left: 272px;
	text-decoration: none;
} */
a.file {
    margin-left: 353px;
}
img.photo {
    margin-left: 0px;
}
div .hidden {
	display: none;
}
.lei input {
	 display : inline;
	 width: 14px;
	 height: 14px;
}
.btn{
	cursor: pointer;
}

</style>
<script type="text/javascript">
	/* var select = $(".select").val();
	console.log(select);
	$.post("carattrval", {
		pid : 2

	}, function(data) {
		$.each(data, function(i, item) {
			if (e.id == data[i].caId) {
				$("#a1").attr("value", data[i].caName);
				$("#a2").attr("value", data[i].avValue);
			}
		});
	}) */
	$(function(){
		$('.lei').on('click','input',function(){
			if ($(this).attr("checked")=="checked") {
				$(this).removeAttr('checked');
				$(this).attr('value','1');
				return;
			}
			if ($(this).attr("checked")!=true) {
				$(this).attr('checked','true');
				$(this).attr('value','0');
				return;
			}
		})
		$('.sss').on('click','.file',function(){
			$('.btn').removeAttr('disabled');
		})
	})
</script>
</head>
<body>

	<ul class="accord">
		<li class="open">通用信息</li>
		<li>商品相册</li>

	</ul>
	<div class="first">
	
		<form action="carmodify?pid=${pid}" method="post">
			<table class="tab1">
				<tr>

					<th>商品名称：</th>
					<td><input name="cname" value="${Cars.cname }"></td>
				</tr>
				<tr>

					<th>商品货号：</th>
					<td><input name="cno" value="${Cars.cno }"></td>
				</tr>
				<tr>

					<th>商品分类：</th>
					<td><select name="csid" >
					
					<c:forEach items="${carstyle}" var="cs">
					<option <c:if test="${cs.csName==Cars.csName }">selected="selected"</c:if> value="${cs.csId }">${cs.csName}
					</option>
				</c:forEach> 
					</select>
					</td>
				</tr>
				
				<tr>

					<th>商品品牌：</th>
					<td><select name="cbid">
					<c:forEach items="${carbrand}" var="cb">
					<option <c:if test="${cb.cbName==Cars.cbName }">selected="selected"</c:if> value="${cb.cbId }">
						${cb.cbName}
					</option>
				</c:forEach> 
					</select>
					
					</td>
				</tr>
				<tr>
					<th>商品用途：</th>
					<td><select name="cuid">
					<c:forEach items="${caruse}" var="cu">
					<option <c:if test="${cu.cuName==Cars.cuName }">selected="selected"</c:if> value="${cu.cuId }">
						${cu.cuName}
					</option>
				</c:forEach> 
					</select>
					
					</td>
				</tr>
				<tr class="lei">
					<th colspan="2">
						<span>精品</span><input type="checkbox" name="cjingpin" 
							<c:if test="${Cars.cJingpin==0}">
								value="0"
								checked=checked
							</c:if>
							<c:if test="${Cars.cJingpin!=0}">
								value="1"
							</c:if>
						>
						<span>新品</span><input type="checkbox" name="cnew"
							<c:if test="${Cars.cNew==0}">
									 value="0"
									 checked=checked
							</c:if>
							<c:if test="${Cars.cNew!=0}">
								value="1"
							</c:if>
							>
						<span>热销</span><input type="checkbox" name="chot"
							<c:if test="${Cars.cHot==0}">
									 value="0"
									 checked=checked
							</c:if>
							<c:if test="${Cars.cHot!=0}">
								value="1"
							</c:if>
							>
					</th>
				</tr>
				<tr>
					<th>汽车详情：</th>
					<td><input name="cinfo" value="${Cars.cinfo }"></td>
				</tr>
				<tr>
					<th>市场售价：</th>
					<td><input name="cmoney" value="${Cars.cmoney }"></td>
				</tr>
			</table>
			<input type="hidden" value="${Cars.cid }" name="id"> <input
				type="hidden" value="${Cars.csid }" name="csid"> <input
				type="hidden" value="${Cars.cbid }" name="cbid">
				<input
				type="hidden" value="${Cars.cuid }" name="cuid">
			<input name="cphoto" value="" class="cart" style="display: none;">
			<button class="btn">提交</button>
		</form>
		
	</div>


	<div class="sss">
		<form action="carmodify?pid=5" method="post" enctype="multipart/form-data">
			<input type="hidden" value="${Cars.cid }" name="id"> 
			<input type="text" value="0" style="display: none;" name="panduan" class="tupd">
			<img class="photo" 
				<c:if test="${Cars.cphoto!=null }">
					src="statics/image/upload/cars/${Cars.cphoto }"
				</c:if>
			
			> <br>
			<a class="file" onclick="$('input[id=lefile]').click();">上传文件</a> <br>
			<button class="btn" 
				<c:if test="${Cars.cname==null }">
					style="display: none;"
				</c:if>
					disabled="disabled"
			>提交</button>


			<input id="lefile" type="file" onchange="pFile()" name="tx"
				style="display: none" /> <input id="photoCover" type="hidden">
		</form>
	</div>


</body>
</html>